import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-05-23
 * Time: 20:51
 */
class Student  {
    public int val;

    public Student(int val) {
        this.val = val;
    }
    @Override
    public String toString() {
        return "Student{" +
                "val=" + val +
                '}';
    }
}
class MyCompare implements Comparator<Student> {
    @Override
    public int compare(Student o1, Student o2) {
        return o2.val - o1.val;
    }
}
public class Main {
    public static void main3(String[] args) {
        MyCompare myCompare = new MyCompare();
        PriorityQueue<Student> priorityQueue = new PriorityQueue<>(myCompare);
        priorityQueue.offer(new Student(15));
        priorityQueue.offer(new Student(20));
        System.out.println(priorityQueue);
    }
    public static void main5(String[] args) {
        PriorityQueue<Student> priorityQueue = new PriorityQueue<>();
        priorityQueue.offer(new Student(15));
        priorityQueue.offer(new Student(20));
        System.out.println(priorityQueue);
    }
    public static void main(String[] args) {
        MyCompare cmp = new MyCompare();
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        priorityQueue.offer(15);
        priorityQueue.offer(20);
        System.out.println(priorityQueue);
    }
    public static void main6(String[] args) {
        TestHeap testHeap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        testHeap.createHeap(array);
       /* testHeap.push(99);*/
        System.out.println(Arrays.toString(testHeap.elem));
        System.out.println();
        testHeap.pollHeap();
        System.out.println(Arrays.toString(testHeap.elem));
        System.out.println();
        System.out.println(testHeap.peekHeap());
    }
    public static void main1(String[] args) {
        TestHeap testHeap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        testHeap.createHeap(array);
        for (int i : testHeap.elem) {
            System.out.print(i+" ");
        }
    }
}
